<template>
	<view>
		<!-- 轮播图 -->
		<swiper autoplay="true" indicator-dots="true" circular="true" style="height: 352upx;">
			<swiper-item v-for="(img,key) in res.data.M1577936916869.data" :key="key">
				<image :src="img.imgurl" style="height: 352upx;width: 100%;" model="aspectFill" />
			</swiper-item>
		</swiper>
		
		<view style="display: flex;background-color: #ffffff;">
			<view v-for="(img,key) in res.data.M1582704980784.data" :key="key" style="width: 200upx;margin: 20upx 30upx; position: relative;">
				<view style="width: 50upx;height: 50upx;border-radius: 30upx;background-color: #ffffff;top: 50upx;position: absolute;left: -25upx;"></view>
				<view style="width: 50upx;height: 50upx;border-radius: 30upx;background-color: #ffffff;top: 50upx;position: absolute;right: -25upx;"></view>
				<view :style="{background:img.background,bordercolor:img.bordercolor}" style="text-align: center;">
					<view style="font-size: 40upx;font-weight: 550;color: #ffffff;">{{img.price}}</view>
					<view style="height: 80upx;line-height: 100upx;position: relative;">
						<view style="width: 80%;height: 55upx;border: 1upx solid #ffffff;position: absolute;line-height: 55upx;text-align: center;border-radius: 20upx;color: #ffffff;left: 10%;top: 20upx;">
							立即领取
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<!-- goods 商品主题场列表-->
		<view v-for="(item,i) in res.data.M1582704986496.data" :key="i" class="item">
			 <!-- @click="jumpgoods" :data-id='item.gid' -->
			<image class="triangle" :src="item.thumb"></image>
			<view class="detail">
				<view class="name">{{item.title}}</view>
				<!-- <view class='productprice' v-if="res.params.showproductprice == 1" :style="{color:res.style.productpricecolor}" v-cloak>{{res.params.productpricetext}}{{item.productprice}}</view> -->
				<!-- <view class='sale' v-if="res.params.showsales == 1" :style="{color:res.style.salescolor}" v-cloak>{{res.params.salestext}}{{item.sales}}</view> -->
				<view class="price webkit" v-if="res.data.M1582704986496.params.showprice == 1">
					 <!-- :style="{color:res.style.pricecolor}" -->
					<text style="font-size: 24upx;" class="flex" v-cloak>¥{{item.price}}</text>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				res:[],
				openid:'',
				
			};
		},
		onLoad:function(){
			uni.showLoading()
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
					this.setAjax()
				},
				fail: () => {
					uni.navigateTo({
						url: '../../login/login'
					});
				}
			});
		},
		methods:{
			setAjax(){
				uni.request({
					url: 'http://hszj.hongshantang696.com//app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=diypage&app=1&id=33',
					success: res => {
						console.log(res)
						this.res = res
					},
					fail: () => {},
					complete: () => {}
				});
				uni.hideLoading()
			},
			jump(e){
				uni.navigateTo({
					url: e.currentTarget.dataset.src
				});
			},
		}
	}
</script>

<style>
	.triangle {
		width: 100%;
		height: 346upx;
		display: block;
	}
	.one .triangle {
		height: 714upx
	}
	.three .triangle {
		height: 224upx
	}
	.detail {
		background: #fff;
		padding: 20upx 12upx;
	}
	.name {
		height: 68upx;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		font-size: 24upx;
		line-height: 36upx;
	}
	.item {
		float: left;
		width: 50%;
		padding: 10upx;
		box-sizing: border-box;
	}
	
	.one .item {
		width: 100%;
	}
	
	.three .item {
		width: 33.33%;
	}
	
</style>
